/*
 * @lc app=leetcode.cn id=1078 lang=javascript
 *
 * [1078] Bigram 分词
 */

// @lc code=start
/**
 * @param {string} text
 * @param {string} first
 * @param {string} second
 * @return {string[]}
 */
var findOcurrences = function (text, first, second) {
  const arr = text.split(' ');
  const res = [];
  arr.forEach((item, index) => {
    if (index < 2) {
      return
    }
    if (arr[index - 2] === first && arr[index - 1] === second) {
      res.push(item);
    }
  })
  return res;
};
// @lc code=end

